{% extends 'front/index.html' %}

{% block content %}
<div class="mobiles">
    <div class="container">
        <div class="w3ls_mobiles_grids">
            <div class="col-md-4 w3ls_mobiles_grid_left">
                <div class="w3ls_mobiles_grid_left_grid">
                    <h3><b>User Center</b></h3>
                    <div class="w3ls_mobiles_grid_left_grid_sub">

                        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
							  <div class="panel panel-default">
								<div class="panel-heading" role="tab" id="headingOne">
								  <h4 class="panel-title asd">
									<a class="pa_italic" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span><i class="glyphicon glyphicon-minus" aria-hidden="true"></i><b>地址管理</b>
									</a>
								  </h4>
								</div>
								<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
								  <div class="panel-body panel_text">
									<ul>
										<li><a href="{% url 'user_address_add' %}">地址添加</a></li>
										<li><a href="{% url 'user_address' %}">地址修改</a></li>
									</ul>
								  </div>
								</div>
							  </div>

							</div>
                        <ul class="panel_bottom">
                            <li><a href="{% url 'user_info' %}"><b>个人信息管理</b></a></li>
                            <li><a href="{% url 'user_payinfo' %}"><b>订单管理</b></a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="col-md-8 w3ls_mobiles_grid_right">
                <h3 align="left"><b>地址修改</b></h3>

                <form action="/user_address/" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <input class="hide" value="{{ user.id }}" name="id">

                    <section>
                        <div class="portlet-body form" style="margin-top: 30px ;">
                            <div class="form-body">
                                <input class="hide" value="{{ user.username }}" name="username">
                                <div class="form-group">
                                    <label class="col-md-2 control-label">收件人：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="name"
                                               value="{{ Address.name }}"
                                               placeholder="会员名称..."/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">省份：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="province"
                                               value="{{ Address.province }}"
                                               placeholder="省份..."/></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">城市：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="city" value="{{ Address.city }}"
                                               placeholder="城市..."/></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">区/县：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="county"
                                               value="{{ Address.county }}"
                                               placeholder="区/县..."/></div>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-2 control-label">详细地址：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="address"
                                               value="{{ Address.address }}"
                                               placeholder="详细地址..."/>
                                    </div>
                                </div>
                                <div class="form-group">
                                        <label class="col-md-2 control-label">手机号码：</label>
                                        <div class="col-md-4">
                                            <input type="tel" class="form-control" name="phone"
                                                   value="{{ Address.phone }}"
                                                   placeholder="手机号码..."/></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">邮编：</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="postcode"
                                               value="{{ Address.postcode }}"
                                               placeholder="邮编..."/></div>
                                </div>
                                <div class="form-actions">
                                    <label class="col-md-2 control-label"></label>
                                    <div class="col-md-4">
                                        <button type="button" class="link_btn"
                                                style="float: left;margin-right: 12px;margin-bottom:30px"
                                                onclick="modify()">修改
                                        </button>
                                        <button type="submit" class="link_btn" style="float: left" onclick ="myFunction()">提交</button>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </section>

                </form>


            </div>
        </div>

    </div>
</div>
<script>
function myFunction()
{
    alert("修改成功！");
}
</script>
<script type="text/javascript">
        jQuery(document).ready(function () {
            $("input").attr("disabled", "disabled");
            $("textarea").attr("disabled", "disabled");

            //对所有None的input赋空值
            $("input").each(function () {
                if ($(this).val() === "None") {
                    $(this).val("");
                }
            });




        });

        function modify() {
            $("input").removeAttr("disabled");
            $("textarea").removeAttr("disabled");
            $("#pictures").removeClass("hide")
        }
    </script>
{% endblock %}

